﻿/*
* Date：2023/5/24
* Subject：品牌控制器
* **/
using Max.PH5_2011A.Domain;
using Max.PH5_2011A.DTO;
using Max.PH5_2011A.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Max.PH5_2011A.API.Controllers.Product
{
    [Route("product/brand")]
    [ApiController]
    public class ProductBrandController : BaseController<ProductBrandModel>
    {
        IProductBrandService _service;
        public ProductBrandController(IProductBrandService serice) : base(serice)
        {
            _service = serice;
        }


        #region admin
        /// <summary>
        /// 后台管理
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet("pages")]
        public IActionResult Query(int pageIndex, int pageSize)
        {
            ResponseResultDto<dynamic> result = new();
            var list = _service.Query();

            int total = list.Count();
            list = list.Skip((pageIndex - 1) * pageSize).Take(pageSize);
            result.Data = new { list, total };
            return Ok(result);
        }
        #endregion

    }
}
